package iot.cassandra;

import com.datastax.driver.mapping.BaseDao;
import com.datastax.driver.mapping.CassandraMapper;
import com.datastax.driver.mapping.MapperFactory;
import iot.entity.Location;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;

/**
 * Created by dave on 18-7-25 下午5:05.
 */
@Service
@ConditionalOnProperty(name = "dao.type", havingValue = "cassandra")
public class CassLocationDao implements BaseDao<Location> {
    private CassandraMapper<Location> mapper;

    public CassLocationDao(MapperFactory factory) {
        this.mapper = factory.mapper(Location.class);
    }

    @Override
    public CassandraMapper<Location> getMapper() {
        return mapper;
    }
}
